package cn.yunyichina.provider.clinic.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import cn.yunyichina.provider.framework.dubbo.service.HisifaceService;
import cn.yunyichina.provider.iface.entity.common.ResCommon;
import cn.yunyichina.provider.iface.entity.common.Response;
import cn.yunyichina.provider.iface.entity.hisiface.clinic.ClinicGuidanceVo;
import cn.yunyichina.provider.iface.entity.hisiface.clinic.ClinicGuidanceVoResponse;
import cn.yunyichina.utils.convert.JsonUtils;

/**
 * 门诊导诊
 */
@Service
public class GuidanceServiceImpl {
    
    /**
     * 门诊导诊查询-外部接口 yyt.clinic.guidance.out.get
     * 
     * @param data
     * @param sessionId
     * @return
     */
    public Response getGuidanceOut(String data, String sessionId){
        
        ClinicGuidanceVo clinicGuidanceVo = JsonUtils.parseObject(data, ClinicGuidanceVo.class);
        
        ResCommon<List<ClinicGuidanceVoResponse>> getClinicGuidance = HisifaceService.getHisifaceClient().getClinicGuidance(clinicGuidanceVo);
        
        Response res = new Response();
        if(ResCommon.SUCCESS_CODE.equals(getClinicGuidance.getResultCode())){
            res.setResult(JsonUtils.toJsonString(getClinicGuidance.getResult()));
        }else{
            res.setResultCodeAndMessage(Response.FAILURE_CODE, getClinicGuidance.getResultMessage());
        }
        return res;
    }
    
}
